<?php

namespace app\index\controller;

use think\exception\ValidateException;
use app\model\Config;

class ConfigController extends Base
{
    public function index()
    {

        $mo = input('post.mo');
        if (empty($mo)) {
            $mo = 'common';
        }

        $data = Config::getconfig($mo);

        $data['SITE_ICON'] = toimg($data['SITE_ICON']);
        $data['poster'] = toimg($data['poster']);
        $data['applypic'] = toimg($data['applypic']);
        $data['module'] = config('my.app_name');

        return $this->json(['data' => $data]);
    }
    public function audit()
    {
        if (input('get.v') == Config::getconfig()['program_version']) {
            $data['is_audit'] = 1;
        } else {
            $data['is_audit'] = 0;
        }
        return $this->json(['data' => $data]);
    }
    public function is_v2()
    {
        if (config('my.app_name') == config('my.app_v2')) {
            return $this->json(['data' => 1]);
        } else {
            return $this->json(['data' => 0]);
        }
    }
    public function is_v3()
    {
        if (config('my.app_name') == config('my.app_v3')) {
            return $this->json(['data' => 1]);
        } else {
            return $this->json(['data' => 0]);
        }
    }
}
